package com.dataStructure;

import java.util.HashMap;

/**
 * hashMap源码分析
 */
public class HashMapDemo {

    /**
     * 构造方法
     *
     *     public HashMap(int initialCapacity) {
     *         this(initialCapacity, DEFAULT_LOAD_FACTOR);
     *     }
     *
     *     public HashMap() {
     *         this.loadFactor = DEFAULT_LOAD_FACTOR; // all other fields defaulted
     *     }
     *
     *     public HashMap(int initialCapacity, float loadFactor) {
     *         if (initialCapacity < 0)
     *             throw new IllegalArgumentException("Illegal initial capacity: " +
     *                                                initialCapacity);
     *         if (initialCapacity > MAXIMUM_CAPACITY)
     *             initialCapacity = MAXIMUM_CAPACITY;
     *         if (loadFactor <= 0 || Float.isNaN(loadFactor))
     *             throw new IllegalArgumentException("Illegal load factor: " +
     *                                                loadFactor);
     *         this.loadFactor = loadFactor;
     *         this.threshold = tableSizeFor(initialCapacity);
     *     }
     *
     *     static final int tableSizeFor(int cap) {
     *         int n = cap - 1;
     *         n |= n >>> 1;
     *         n |= n >>> 2;
     *         n |= n >>> 4;
     *         n |= n >>> 8;
     *         n |= n >>> 16;
     *         return (n < 0) ? 1 : (n >= MAXIMUM_CAPACITY) ? MAXIMUM_CAPACITY : n + 1;
     *     }
     */
    public void demo(){
        HashMap hashMap=new HashMap();
    }

}
